<include file='Base:header' />
	<body>
		<div class="submit">
			<h1 class="title">
				<a class="back" href="{$goback}">
					<img class="fl" src="__IMG__/back.png" style="margin-left: 5%;"/>
				</a>
				我的补办打卡
				<a class="home" href="__APP__">
					<img class="fl" src="__IMG__/home_logo.png" style="margin-right: 5%;"/>
				</a>
			</h1>
			<include file='Base:_submit_intro' />
		    <form action="{:U('')}" method='post' class='ajax-form'>
		    	<php>
		    		if ($_GET['year']){
		        		$date = $_GET['year'].'-'.$_GET['month'].'-'.$_GET['day'].' ';
		        		$start_time = $date.$_GET['duty'];		    			
		    		}
		        </php>
		        <div class="weui-cells weui-cells_form">
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">类型</label></div>
						<div class="weui-cell__bd">
							<input class="weui-input card_input" id="duty_type" type="text" value="" placeholder='请选择类型' name='duty_type'>
						</div>
		            </div>
		            <div class="weui-cell">
		                <div class="weui-cell__hd"><label class="weui-label">打卡时间</label></div>
						<div class="weui-cell__bd">
							<input class="weui-input card_input" id="starttime" type="text" value="{$start_time}" name='repair_time' readonly>
						</div>
		            </div>
		        </div>
		      	
		      	<div class="sumbit_btn">
					<input type="button" class="weui-btn weui-btn_mini weui-btn_primary ajax-submit" style="margin: 0 auto;" value="提交">
				</div>
		    </form>
		</div>

		<include file='Base:footer' />
		<script type="text/javascript">
		$("#duty_type").picker({
			  title: "请选择补打卡类型",
			  cols: [
			    {
			      textAlign: 'center',
			      values: ['上班', '下班']
			    }
			  ]
			});
		
		
		
			function GetArgsFromHref(sHref, sArgName){
			      var args    = sHref.split("?");
			      var retval = "";
			    
			      if(args[0] == sHref) /*参数为空*/
			      {
			           return retval; /*无需做任何处理*/
			      }  
			      var str = args[1];
			      args = str.split("&");
			      for(var i = 0; i < args.length; i ++)
			      {
			          str = args[i];
			          var arg = str.split("=");
			          if(arg.length <= 1) continue;
			          if(arg[0] == sArgName) retval = arg[1]; 
			      }
			      return retval;
			}
			
			var duty = GetArgsFromHref(window.location.href,'duty');
			if(duty == ""){
				//当前时间
				var time = new Date();
				var now_y = time.getFullYear();
				var now_m = time.getMonth()+1;
				var now_d = time.getDate();
				var now_h = time.getHours();
				var now_min = time.getMinutes();
				var min_y = time.getFullYear()-1;
				var max_y = time.getFullYear()+1;
				var buling = function(a){
					if(a<10){
						return "0" + a;
					}else{
						return a;
					}
				}
				now_m = buling(now_m)
				now_d= buling(now_d)
				now_h = buling(now_h)
				now_min= buling(now_min)
				var min_day = min_y + "-01-01";
				var max_day = max_y + "-"+now_m+"-"+now_d;
				
				$("#starttime").datetimePicker({
					yearSplit: "-",
					monthSplit: "-",
					dateSplit: "",
					min: min_day,
					max: max_day,
				});
				var now_time = now_y+"-"+now_m+"-"+now_d+" "+now_h+":"+now_min;
				$("#starttime").attr("value",now_time);
			}else{
				$("#starttime").datetimePicker({
					yearSplit: "-",
					monthSplit: "-",
					dateSplit: "",
//					min: min_day,
//					max: max_day,
				});
			}
		</script>
	</body>

</html>